package chatuidemo.holder;

import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.ysm.smfu.R;
import com.ysm.smfu.bean.Friend;
import com.ysm.smfu.holder.BaseHolder;
import com.ysm.smfu.utils.UIUtils;

/**
 * Created by Administrator on 2016/10/20.
 */
public class FriendHolder extends BaseHolder<Friend> {

    private ImageView img;
    private TextView nc;

    @Override
    protected View initView() {

        View view = UIUtils.inflate(R.layout.list_item_search);
        img = (ImageView) view.findViewById(R.id.img);
        nc = (TextView) view.findViewById(R.id.nc);
        return view;
    }

    @Override
    protected void refreshView(Friend data) {

        if (!TextUtils.isEmpty(data.petName)) {
            nc.setText(data.petName);
        } else {
            nc.setText(data.phone);
        }
    }
}
